package controller

import (
	"system-admin/internal/app/web/service/file"

	"192.168.1.75/go-pkg/response"
	"github.com/gin-gonic/gin"
)

type File struct{}

func (File) Upload(c *gin.Context) {
	url, fileName, err := file.UploadFile(c)
	if err != nil {
		response.JSON(c, nil, err)
		return
	}
	response.JSON(c, map[string]interface{}{
		"url":       url,
		"file_name": fileName,
	}, nil)
}
